package com.lmx.repoDomain.tmodel;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ForeignKey;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

import com.lmx.repoDomain.tmodel.business.User;

import io.katharsis.resource.annotations.JsonApiIncludeByDefault;
import io.katharsis.resource.annotations.JsonApiResource;
import io.katharsis.resource.annotations.JsonApiToOne;

/**
 * 客户退住结算单
 */
@JsonApiResource(type = "settlementBill")
@Table(name = "tnb_settlement_bill")
@Entity
public class SettlementBill extends BaseEntity {
	private String remark;// 备注
	
	private User lastUpdateUser;// 更新操作者userid
	
	private Integer createDateTime;// 创建时间
	
	private User createUser;	// 提交人
	
	private Integer lastUpdateDateTime;	// 更新时间
	
	private Customer customer;	// 账单客户

	private Dicttype billType;	// 退费/扣费
	
	private Double depositAmount;	// 保证金退费金额
	
	private Double accountAmount;	// 账户结算金额
	
	private Double totalAmount;	// 账单总金额（最后填写的金额，可修改）
	
	private Integer createTime;	// 记录生成时间
	
	private Integer billTime;	// 账单提交时间
	
	private Integer auditTime;	// 审核时间
	
	private User operateUser;	// 审核人
	
	private Dicttype billStatus;// 同 日结算账单 状态
	
	@JsonApiToOne
	@JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.SELECT)
	@JoinColumn(name = "billstatus_id", foreignKey = @ForeignKey(name = "null"))
	public Dicttype getBillStatus() {
		return billStatus;
	}

	public void setBillStatus(Dicttype billStatus) {
		this.billStatus = billStatus;
	}

	@Column(name = "bill_time")
	public Integer getBillTime() {
		return billTime;
	}

	public void setBillTime(Integer billTime) {
		this.billTime = billTime;
	}

	@JsonApiToOne
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@JoinColumn(name = "customer_id", foreignKey = @ForeignKey(name = "null"))
	public Customer getCustomer() {
		return customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	@Column(name = "createDateTime")
	public Integer getCreateDateTime() {
		return createDateTime;
	}

	public void setCreateDateTime(Integer createDateTime) {
		this.createDateTime = createDateTime;
	}

	@Column(name = "lastUpdateDateTime")
	public Integer getLastUpdateDateTime() {
		return lastUpdateDateTime;
	}

	public void setLastUpdateDateTime(Integer lastUpdateDateTime) {
		this.lastUpdateDateTime = lastUpdateDateTime;
	}

	@JsonApiToOne
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@JoinColumn(name = "createuser_id", foreignKey = @ForeignKey(name = "null"))
	public User getCreateUser() {
		return createUser;
	}

	public void setCreateUser(User createUser) {
		this.createUser = createUser;
	}

	@JsonApiToOne
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@JoinColumn(name = "lastupdateuser_id", foreignKey = @ForeignKey(name = "null"))
	public User getLastUpdateUser() {
		return lastUpdateUser;
	}

	public void setLastUpdateUser(User lastUpdateUser) {
		this.lastUpdateUser = lastUpdateUser;
	}

	@Column(name = "remark")
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}
	
	@JsonApiToOne
	@JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.SELECT)
	@JoinColumn(name = "billtype_id", foreignKey = @ForeignKey(name = "null"))
	public Dicttype getBillType() {
		return billType;
	}

	public void setBillType(Dicttype billType) {
		this.billType = billType;
	}

	@Column(name = "depositAmount")
	public Double getDepositAmount() {
		return depositAmount;
	}

	public void setDepositAmount(Double depositAmount) {
		this.depositAmount = depositAmount;
	}

	@Column(name = "accountAmount")
	public Double getAccountAmount() {
		return accountAmount;
	}

	public void setAccountAmount(Double accountAmount) {
		this.accountAmount = accountAmount;
	}
	
	@Column(name = "totalAmount")
	public Double getTotalAmount() {
		return totalAmount;
	}

	public void setTotalAmount(Double totalAmount) {
		this.totalAmount = totalAmount;
	}

	@Column(name = "createTime")
	public Integer getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Integer createTime) {
		this.createTime = createTime;
	}

	@Column(name = "auditTime")
	public Integer getAuditTime() {
		return auditTime;
	}

	public void setAuditTime(Integer auditTime) {
		this.auditTime = auditTime;
	}
	
	@JsonApiToOne
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@JoinColumn(name = "operateuser_id", foreignKey = @ForeignKey(name = "null"))
	public User getOperateUser() {
		return operateUser;
	}

	public void setOperateUser(User operateUser) {
		this.operateUser = operateUser;
	}

}
